SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_C_COMPILER "arm-uclibc-linux-2.6.36-gcc")
cmake_minimum_required(VERSION 2.6)

# The name of our project is "L2DRIVER".  CMakeLists files in this project can
# refer to the root source directory of the project as ${L2DRIVER_SOURCE_DIR}
# and to the root binary directory of the project as ${L2DRIVER_BINARY_DIR}.
PROJECT(L2DRIVER_LITE)

# Add include directories to the build.
include_directories(${L2DRIVER_LITE_SOURCE_DIR})
include_directories(${L2DRIVER_LITE_SOURCE_DIR}/l2driver)

# Specify directories in which the linker will look for libraries.

# Collects the names of all the source files in the specified directory and
# stores the list in the variable SRCS provided.
aux_source_directory(core SRCS)
aux_source_directory(core/transactions SRCS)

# Add a library to the project using the specified source files.
add_library(l2driver STATIC ${SRCS})

# Added some compile flags
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
  IF(SUPPORT_HOMEPLUG_L2RXTHREAD)
  set_target_properties(l2driver PROPERTIES COMPILE_FLAGS "-DSUPPORT_HOMEPLUG_L2RXTHREAD -DENABLE_DEBUG -g")
  ELSE(SUPPORT_HOMEPLUG_L2RXTHREAD)
  set_target_properties(l2driver PROPERTIES COMPILE_FLAGS "-DENABLE_DEBUG -g")
  ENDIF(SUPPORT_HOMEPLUG_L2RXTHREAD)
ELSE()
  IF(SUPPORT_HOMEPLUG_L2RXTHREAD)
  set_target_properties(l2driver PROPERTIES COMPILE_FLAGS "-DSUPPORT_HOMEPLUG_L2RXTHREAD -Os -s")
  ELSE(SUPPORT_HOMEPLUG_L2RXTHREAD)
  set_target_properties(l2driver PROPERTIES COMPILE_FLAGS "-Os -s")
  ENDIF(SUPPORT_HOMEPLUG_L2RXTHREAD)
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
